<?php
class ManagerRole
{
	public static function getRoleInfFromCookie($fromUrl)
	{
		$managerCookie = new LtCookie;
		$strFromCookie = $managerCookie->getCookie('spread_manager');
		$jumptoLogin = C('LtUrl')->generate('manage','Login',array('gourl'=>base64_encode(trim($fromUrl))));
		
		//$jumptoLogin .= "&gourl=".rawurlencode(trim($fromUrl));
		if(empty($strFromCookie))
		{
			header('Location: '.$jumptoLogin);
			return NULL;
		}

		$infre = explode("---",$strFromCookie);
		if(3 != count($infre))
		{
			header('Location: '.$jumptoLogin);
			return NULL;
		}
		$cookieExptime = time()-intval($infre[1]);
		if($cookieExptime > 660)
		{
		}

		$re = array(
			'username'=>$infre[0],
			'cookietime'=>$infre[1]);
		return $re;
	}
}
